package com.chengqs.rainbow.common.core.constant;

/**
 * <B>主类名称：</B>RedisConstants<BR>
 * <B>概要说明：</B>enter<BR>
 *
 * @author: chengqs
 * @create: 2025-09-13 20:41:41
 **/
public class RedisConstants {

    // 分隔符常量（替代原来的 ENTER_NAME）
    public static final String KEY_SEPARATOR = "::";
    public static final String COLON = ":";
    public static final String HYPHEN = "-";
    public static final String UNDERSCORE = "_";
    public static final String PIPE = "|";

    // 时间相关常量
    public static final long ONE_MINUTE = 60L;
    public static final long FIVE_MINUTES = 300L;
    public static final long ONE_HOUR = 3600L;
    public static final long ONE_DAY = 86400L;
    public static final long ONE_WEEK = 604800L;
    public static final long THIRTY_DAYS = 2592000L;

    // 缓存键前缀（按业务模块划分）
    public static final String CACHE_PREFIX_USER = "user" + KEY_SEPARATOR;
    public static final String CACHE_PREFIX_ORDER = "order" + KEY_SEPARATOR;
    public static final String CACHE_PREFIX_PRODUCT = "product" + KEY_SEPARATOR;
    public static final String CACHE_PREFIX_SESSION = "session" + KEY_SEPARATOR;
    public static final String CACHE_PREFIX_CONFIG = "config" + KEY_SEPARATOR;

    // 分布式锁相关
    public static final String LOCK_PREFIX = "lock" + KEY_SEPARATOR;
    public static final long DEFAULT_LOCK_TIMEOUT = 30000L; // 30秒
    public static final long DEFAULT_ACQUIRE_TIMEOUT = 5000L; // 5秒获取超时

    // 限流相关
    public static final String RATE_LIMIT_PREFIX = "rate_limit" + KEY_SEPARATOR;
    public static final String API_RATE_LIMIT_PREFIX = "api_rate_limit" + KEY_SEPARATOR;

    // 消息队列相关
    public static final String MQ_TOPIC_PREFIX = "mq_topic" + KEY_SEPARATOR;
    public static final String MQ_GROUP_PREFIX = "mq_group" + KEY_SEPARATOR;

    // 统计计数相关
    public static final String STATS_PREFIX = "stats" + KEY_SEPARATOR;
    public static final String COUNTER_PREFIX = "counter" + KEY_SEPARATOR;

    // 布隆过滤器相关
    public static final String BLOOM_FILTER_PREFIX = "bloom_filter" + KEY_SEPARATOR;

    // 空值缓存（防缓存穿透）
    public static final String NULL_VALUE = "NULL";
    public static final long NULL_VALUE_TTL = 300L; // 5分钟

    // Redis配置模式
    public static final String MODE_STANDALONE = "standalone";
    public static final String MODE_CLUSTER = "cluster";
    public static final String MODE_SENTINEL = "sentinel";

    // 默认配置值
    public static final int DEFAULT_DATABASE = 0;
    public static final int DEFAULT_MAX_TOTAL = 8;
    public static final int DEFAULT_MAX_IDLE = 8;
    public static final int DEFAULT_MIN_IDLE = 0;
    public static final long DEFAULT_MAX_WAIT_MILLIS = 3000L;

    // Redis命令执行结果
    public static final String OK = "OK";
    public static final Long SUCCESS = 1L;
}
